<{include file="public/header.tpl"}>
<div id="page-wrapper">

	<{ include file="public/title.tpl" }>

	<script>
		function checkselect(obj){
			if(obj.pid.options[obj.pid.selectedIndex].value==0){
				var outmess=document.getElementById("outmess");
				outmess.innerHTML="还没有选分类";
				outmess.className+=" error-msg";
				return false;
			}
			return true;
		}
	</script>
    <form  method="post" action="<{$url}>/insert" onsubmit="return checkselect(this)" enctype="multipart/form-data">
    <li class="list-group-item">
		<span class="label label-info">添到相册</span><{ $select }>
	</li>
	<li class="list-group-item">
		<span>&nbsp; </span>
		<input type="checkbox" name="thumb" <{$thumb}> value="1"> 生成缩略图 
		<input type="checkbox" name="water" <{$water}> value="1"> 加水印 
	</li>
	<li class="list-group-item">
		<span class="label label-info">上传图片 </span>
	</li>
	<span id="apic" >
		<input type="file"  name="pic[]" ><br>
		</span>
		<a href="javascript:addpic()">继续添加</a>&nbsp;<b>↓</b>
		<span id="del" style="display:none">&nbsp;&nbsp;<a href="javascript:delpic()">减少一个</a>&nbsp;<b>↑</b></span>
		<script>
		var picobj=document.getElementById("apic");
		var del=document.getElementById("del");
		var i=0;
		function addpic(){
			i++;
			if(i==1)
				del.style.display="inline";   										

			var file=document.createElement("input");
			file.type="file";
			file.name="pic[]";
			var br=document.createElement("br");
			picobj.appendChild(file);	
			picobj.appendChild(br);
		
		}
		function delpic(){
			i--;
			if(i==0)
				del.style.display="none";   
			picobj.removeChild(picobj.lastChild);
			picobj.removeChild(picobj.lastChild);
		}
	</script>
	<li class="list-group-item">
		    <button type="submit" class="btn btn-primary">添 加</button>
		    &nbsp;&nbsp;
		    <button type="reset" class="btn btn-primary">重 置</button>
	</li>
    </form>	
</div>
<{include file="public/footer.tpl"}>	


